const user = {
    state: {
        id: 0,
        username: "",
        identity:"",
        sta:"",
        shot:"",
        phone:"",
        email:"",
        room:"",
        money:""
    },
    getters: {
        //获取id
        getId(state) {
            return state.id
        },
        getUsername(state) {
            return state.username
        },
        getIdentity(state){
            return state.identity
        },
        getState(state){
            return state.sta
        },
        getPhone(state){
            return state.phone
        },

        getRoom(state){
            return state.room
        },

        getMoney(state){
            return state.money
        }
    },
    mutations: {
        //保存id
        saveId(state, id) {
            state.id = id
        },
        saveMoney(state, money) {
            state.money = money
        },
        saveAll(state, user) {
            state.id = user.userId
            state.username=user.name
            state.shot=user.shot
            state.email=user.email
            state.room=user.room
            state.identity=user.identity
            state.phone=user.phone
            state.sta=user.state
            state.money=user.money
        },
        saveUsernameAndId(state, user) {
            state.id = user.userId
            state.username=user.name
        },
        clearUsernameAndId(state){
            state.id = "0"
            state.username=""
            state.shot=""
            state.email=""
            state.room=""
            state.identity=""
            state.phone=""
            state.sta="0"
        },

    },
    actions: {}
}
export default user